package org.lanqiao.tools;

import java.util.Properties;

import javax.sql.DataSource;

import org.apache.commons.dbutils.QueryRunner;

import com.alibaba.druid.pool.DruidDataSourceFactory;

public class BaseDao {
	public static QueryRunner query= new QueryRunner();
	static {
		Properties properties = new Properties();
		// 获取当前src目录 BaseDao.class.getResource("/")：src目录
		//										没有 / 就是BaseDao的当前目录
		// BaseDao.class.getResource("/config.propertie").op
		try {
			properties.load(BaseDao.class.getResource("/mysqlconn.propertie").openStream());
			DataSource ds = DruidDataSourceFactory.createDataSource(properties);
			query = new QueryRunner(ds);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
